package com.example.a22310.myapplication.ViewModel.User;

import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

import com.example.a22310.myapplication.Listener.ClubListener;
import com.example.a22310.myapplication.Model.UserModel;

import okhttp3.MultipartBody;

public class AlterInformationViewModel implements ClubListener<UserModel> {
    private ActivityUserInformationBinding binding;
    private AppCompatActivity activity;
    private int userid;
    private String username,address;
    private  MultipartBody.Part file;


    public AlterInformationViewModel(AppCompatActivity activity, ActivityUserInformationBinding binding, int userid,
                                     String username, String address, MultipartBody.Part file){
        this.activity = activity;
        this.binding = binding;
        this.userid = userid;
        this.username = username;
        this.address = address;
        this.file = file;
        binding.setAlter(this);
        UserModel userModel=new UserModel();
        userModel.alterUser(AlterInformationViewModel.this,userid,username,address,file);


    }


    @Override
    public void setContentView() {

    }

    @Override
    public void initView() {

    }

    @Override
    public void initEvent() {

    }

    @Override
    public void setTitle() {

    }

    @Override
    public void onBackPressed() {

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        return false;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        return false;
    }

    @Override
    public void onSuccess(UserModel user) {
        Toast.makeText(activity,"上传成功",Toast.LENGTH_LONG).show();
    }

    @Override
    public void onFailure() {
        Toast.makeText(activity,"连接服务器失败",Toast.LENGTH_LONG).show();
    }}
